% "Procyclical leverage and crisis probability in a macroeconomic model of bank runs"
% Daisuke Ikeda and Hidehiko Matsumoto
% Figure 2

clear
load data_figure2

% figure
figure('OuterPosition',[122.6 444.2 965.6 391.2]);

subplot1 = subplot(1,2,1);
hold(subplot1,'on');

plot1 = plot(X1,YMatrix1);
set(plot1(1),'DisplayName','Liability','Marker','o','LineStyle','none',...
    'Color',[1 0 0]);
set(plot1(2),'DisplayName','Equity','Marker','x','LineStyle','none',...
    'Color',[0 0 1]);
set(plot1(3),'Color',[1 0 0]);
set(plot1(4),'Color',[0 0 1]);

text('FontSize',12,'Interpreter','latex','String','$$ \hat{\beta}=0.98 $$',...
    'Position',[12.8301886792453 45.7377049180328 0]);

ylabel('Changes in equity & liability','FontSize',11);

xlabel('Change in asset','FontSize',11);

title('Balance sheet change (billion USD)','FontSize',12);

box(subplot1,'on');
grid(subplot1,'on');
hold(subplot1,'off');

legend1=legend('Liability','Equity');
set(legend1,...
    'Position',[0.148966002017207 0.768763799672622 0.104100944868022 0.120860923994456],...
    'FontSize',11);

subplot2 = subplot(1,2,2);
hold(subplot2,'on');

plot2 = plot(X2,YMatrix2);
set(plot2(1),'Marker','o','LineStyle','none','Color',[0 0 1]);
set(plot2(2),'Color',[1 0 0]);

text('FontSize',12,'Interpreter','latex','String','$$ \hat{\beta}=0.71 $$',...
    'Position',[-1.3166144200627 5.08196721311475 1.4210854715202e-14]);

ylabel('% Change in leverage','FontSize',11);

xlabel('% Change in asset','FontSize',11);

title('Leverage growth and asset growth (%)','FontSize',12);

box(subplot2,'on');
grid(subplot2,'on');
hold(subplot2,'off');
